/// YApi QuickType插件生成，具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation

import 'dart:convert';

import 'package:latlong2/latlong.dart';

UserLatlonDomain userLatlonDomainFromJson(String str) =>
    UserLatlonDomain.fromJson(json.decode(str));

String userLatlonDomainToJson(UserLatlonDomain data) =>
    json.encode(data.toJson());

class UserLatlonDomain {
  UserLatlonDomain({
    required this.name,
    required this.id,
    required this.type,
    required this.list,
  });

  String name;
  int id;
  String type;
  List<LatLng> list;

  factory UserLatlonDomain.fromJson(Map<dynamic, dynamic> json) =>
      UserLatlonDomain(
        name: json["name"],
        id: json["id"],
        type: json["type"],
        list:
            List<LatLng>.from(
              jsonDecode(json["list"]).map((x) => LatLng(x["lat"], x["lon"])),
            ).toList(),
      );


  Map<dynamic, dynamic> toJson() => {
    "name": name,
    "id": id,
    "type": type,
    "list": List<dynamic>.from(list.map((x) => x.toJson())),
  };

  static final tableName = "user_latlon";

  //建表语句
  static String createTableSql = '''
      CREATE TABLE If NOT EXISTS $tableName  (
        id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, 
        name    TEXT ,
        type  TEXT,
        list   TEXT
      );
      ''';
}
